import Relay from 'react-relay';

export default class AddSsidMutation extends Relay.Mutation {
  static fragments = {};

  getConfigs() {
    return [{
      type: 'RANGE_ADD',
      parentName: 'profile',
      parentID: this.props.payload.profile_id,
      connectionName: 'ssids',
      edgeName: 'ssidEdge',
      rangeBehaviors: () => 'prepend',
    }];
  }

  getMutation = () => Relay.QL`mutation { addSsid }`;

  getVariables() {
    return { ...this.props.payload };
  }

  getFatQuery = () => (
    Relay.QL`
      fragment on addSsidPayload {
        profile{
          ssids
        }
        ssidEdge
      }
    `
  )
}
